<%--
  Created by IntelliJ IDEA.
  User: 19373
  Date: 2022/3/1
  Time: 14:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/mytaglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加新闻</title>
    <style>
        @import url("../css/commontopic.css");

        p {
            font-size: 15px;
            margin-top: 10px;
        }

        .upload_but {
            width: 60px;
            height: 30px;
        }
    </style>
</head>
<body>
<%@include file="../common/headertopic.jsp" %>
<div class="center" style="height: 460px">
    <%@include file="../common/leftmenutopic.jsp" %>
    <div style="width: 86%;margin-left: 40vh">
        <form method="post" action="<%=request.getContextPath()%>/addPublishNews">
            <label>主题：</label>
            <label>
                <select id="topicName" name="theme">

                </select>
            </label><br>
            <label>
                标题：
                <input type="text" name="title" placeholder="输入标题">
            </label><br>
            <label>
                作者：
                <input type="text" name="username" placeholder="输入作者">
            </label><br>
            <label>
                摘要：
                <textarea name="digest" style="width: 400px;height: 50px;"></textarea>
            </label><br>
            <label>
                内容：
                <textarea name="content" style="width: 400px;height: 150px;"></textarea>
            </label><br>
            <p>
                <a href="../suc.jsp"><input type="submit" value="保存" class="upload_but"></a>
                <input type="reset" value="重置" class="upload_but">
            </p>
        </form>

        <form method="post" enctype="multipart/form-data" action="<c:url value="/addPublishRes"/>">
            <p>上传文件：<input type="file" name="fileName"></p>
            <p>
                <a href="../suc.jsp"><input type="submit" value="提交" class="upload_but"></a>
                <input type="reset" value="重置" class="upload_but">
            </p>
        </form>
    </div>
</div>
<%@include file="../common/footertopic.jsp" %>
<script>
    $(document).ready(function () {
        $.ajax({
            type: "POST",
            url: "${ctx}/SelTopic?oper=getTopicName",
            data: "k1:v1",
            dataType: "json",
            success: function (msg) {
                let topicRes = '';
                $.each(msg, function (i, item) {
                    topicRes += '<option value="' + item.id + '">' + item.topicName + '</option>';
                    // alert(topicRes);
                    $("#topicName").html(topicRes);
                })
            }
        });
    });
</script>
</body>
</html>